﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Twittit.Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void loginsubmit_Click(object sender, EventArgs e)
        {
            String login = LoginTextbox.Text;
            String pass = PasswordTextbox.Text;

            // TODO : validators

            if (Twittit.Business.UserService.getInstance().checkPassword(login, pass))
            {
                Session["username"] = login;
                Response.Redirect("Default.aspx");
            }
            else
            {
                LoginErrorLabel.Text = "Login ou mot de passe incorrect";
            }
                         
        }

    }
}